home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
libs
/
intoids.lha
/
Intoids 1.0
/
Source
/
Intoids.h
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-12
|
8KB
|
216 lines
#ifndef LIBRARIES_INTOIDS_H
#define LIBRARIES_INTOIDS_H 1
/******************************************************************************
* $Header: Big:Programming/C/Intoids/Library/RCS/Intoids.h,v 1.16 1997/02/12 16:47:30 AGMS Exp $
*
* Datatype declarations for intoids.library - An Amiga runtime shared code
* library for efficiently handling large and small integer values using
* pointer sized data fields.
*
* Look in Intoids.c for documentation, e-mail addresses and credits.
*
* Modifications for storing smaller integers in 32 bit values and conversion
* to an Amiga library copyright © 1996 by Alexander G. M. Smith.
* Original long integer code copyright © 1988 Free Software Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: Intoids.h,v $
* Revision 1.16 1997/02/12 16:47:30 AGMS
* Added header stuff for AGMS Portable Integer Format functions.
*
* Revision 1.15 1997/01/14 14:53:58 AGMS
* Increased number of printable digits (and stack usage) to 1000.
*
* Revision 1.14 1997/01/12 12:30:48 AGMS
* Rearranged stuff so that it fits in with the standard Amiga C compiler
* include directory structure (prototypes and headers in separate files).
*
* Revision 1.13 1996/12/29 09:27:53 AGMS
* *** empty log message ***
*
* Revision 1.12 1996/12/28 13:35:45 AGMS
* Added Absolute value.
*
* Revision 1.11 1996/12/28 13:20:13 AGMS
* Added SignOfIntoid function, changed comparison result to be +-1.
*
* Revision 1.10 1996/12/26 13:24:03 AGMS
* Added NegateIntoid function.
*
* Revision 1.9 1996/12/17 17:08:26 AGMS
* Need a long, not an int return value for comparisons.
*
* Revision 1.8 1996/12/17 15:54:24 AGMS
* Added function for comparing intoids.
*
* Revision 1.7 1996/12/07 15:59:52 AGMS
* *** empty log message ***
*
* Revision 1.6 1996/12/04 16:56:16 AGMS
* Added CopyIntoid function.
*
* Revision 1.5 1996/12/03 16:18:37 AGMS
* Changed AsciiToIntoid to be more like the UNIX equivalent.
*
* Revision 1.4 1996/11/28 16:05:26 AGMS
* Added error strings by number, some other stuff.
*
* Revision 1.3 1996/11/21 16:16:18 AGMS
* Now compiles, but doesn't have any guts yet.
*
* Revision 1.2 1996/11/18 17:24:36 AGMS
* Whittled down to just the basic functions, added RecycleMe arguments.
*
* Revision 1.1 1996/11/14 18:00:57 AGMS
* Initial revision
*/
#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif
#define IntoidsName "intoids.library"
/* Name to use when opening the Intoids shared library. All lower case. */
#define MAX_INTOID_ASCII_DIGITS 1000
/* Maximum number of digits that can be output by the Intoid to Ascii
functions. The library's internal number conversions use a buffer of this
size allocated on the calling task's stack, so watch out! */
#define SmallIntToIntoid(x) ((Intoid) ((((long) (x)) << 1) | 1))
/* Converts a short integer or char (unsigned or signed) to an Intoid. Will
also work for long integers if they aren't larger than 0x3FFFFFFF in
absolute value. Use LongToIntoid to properly handle larger longs. */
#define INTOID_POSITIVE_INFINITY ((Intoid) 6)
#define INTOID_NEGATIVE_INFINITY ((Intoid) 10)
/* Special magic codes for infinity values as Intoids. Related to the
private IntoidSpecialCodes enum and the SpecialCodeToIntoid macro. */
typedef void * Intoid;
/* As far as the user sees it, it is an opaque type. Treat it like
a pointer to a dynamically allocated object, though it sometimes
isn't and sometimes is. A NULL (zero) value Intoid means that an error
happened (out of memory, divide by zero, etc), an error message can be
obtained by calling GetLastIntoidErrorMessage (though it may be incorrect if
other tasks have caused errors since the time your program caused an error).
Besides storing really big numbers and not-a-number, the Intoids can also
represent positive and negative infinity. */
#if __SASC
#define STACKCALL __stdargs /* Pass arguments on stack, not in registers. */
#else /* Some other compiler, assumes it uses stack by default. */
#define STACKCALL
#endif
typedef enum PortIntCallBackOpEnum
{
PICBOP_READ = 0,
PICBOP_SEEK = 1,
PICBOP_WRITE = 2,
PICBOP_MAX
} PortIntCallBackOp;
/* The various operations that the callback function can do. See
the intoids.library/AGMSPortableIntStreamCallBack autodocs for details. */
typedef LONG (* STACKCALL PortIntCallBackPntr) (ULONG, APTR, LONG, APTR);
/* Define the type for a pointer to a callback function that is used for
reading and writing AGMS Portable Integer numbers to a stream. See
the intoids.library/AGMSPortableIntStreamCallBack autodocs for details. */
typedef enum IntoidStringNumberEnum
{
MSG_INTOIDS_NOT_A_NUMBER = 0,
/* Used in ASCII conversions for things that are not a number. You
get this when you divide by zero, or run out of memory (the NULL pointer of
numbers). Default is "not-a-number". */
MSG_INTOIDS_INFINITY,
/* Infinity is represented in ASCII as this value. There can be an
optional sign ("+" or "-") in front for positive or negative infinity.
The same string is used when converting infinite values to strings.
Default is "infinity". */
MSG_INTOIDS_NUMBER_TOO_BIG_TO_PRINT,
/* Printed when the number is too big for the internal buffers, in other
words there are more than MAX_INTOID_ASCII_DIGITS digits in the number.
Default is "(too big to print)". */
MSG_INTOIDS_PRINTING_OUT_OF_MEMORY,
/* For use when running out of memory when printing a big number. Default
is "(out of memory)". */
MSG_INTOIDS_NEW_TOO_BIG,
/* When something wants more digits than can be created (more than 64K
digits). Default is "Attempt to create a number bigger than the maximum
allowed size.". */
MSG_INTOIDS_INTREP_OUT_OF_MEMORY,
/* Used when trying to allocate memory for the integer representation (the
bits themselves) for an Intoid. Default: "Out of memory for allocating
Intoid data bits.". */
MSG_INTOIDS_CREDITS,
/* A long text with the credits for the program, including GNU license
information. */
MSG_INTOIDS_CONTINUE_SHOWING_ERRORS,
/* For requestor that asks if it should continue showing error messages.
Default: "Continue showing intoids.library error messages?". */
MSG_INTOIDS_BAD_INPUT_PARMS,
/* Bad input parameters passed to some function. Things like NULL
pointers or a Base out of range. Default: "Bad function input
parameters.". */
MSG_INTOIDS_DIVIDE_BY_ZERO,
/* Somebody divided by zero. Default: "Divide by zero.". */
MSG_INTOIDS_PI_READ_ERROR,
/* Read error. Default: "Error while reading portable integer data.". */
MSG_INTOIDS_PI_WRITE_ERROR,
/* Write error. Default: "Error while writing portable integer data." */
MSG_INTOIDS_PI_SEEK_ERROR,
/* Seek error. Default: "Error while seeking in portable integer data." */
MSG_INTOIDS_PI_BAD_FORMAT,
/* Number is weird, perhaps too big to handle, having an unknown number
kind, etc. Default: "Portable integer has unusual format, bad data?" */
MSG_INTOIDS_UNKNOWN_MESSAGE,
/* Used when an out of range message code is found. */
MSG_INTOIDS_MAX
} IntoidStringNumbers;
/* To help make strings localized for different languages, this enum of
string numbers is used rather than the strings themselves. The
GetIntoidsMessage function is used for getting the actual string that
corresponds to the number. */
#endif /* LIBRARIES_INTOIDS_H */